﻿' _______ _________                  ______           __       _______ 
'(  ____ \\__   __/       |\     /| (  ___ \         /  \     (  __   )
'| (    \/   ) (          | )   ( | | (   ) )        \/) )    | (  )  |
'| (__       | |          | |   | | | (__/ /           | |    | | /   |
'|  __)      | |          ( (   ) ) |  __ (            | |    | (/ /) |
'| (         | |           \ \_/ /  | (  \ \           | |    |   / | |
'| (____/\   | |            \   /   | )___) )        __) (_ _ |  (__) |
'(_______/   )_(    _____    \_/    |/ \___/  _____  \____/(_)(_______)
'                  (_____)                   (_____)             

Public Class PURIv2
    Dim Form1StartPosition As Point
    Dim Form1DragPosition As Point

    Dim help_B As Boolean
    Dim help_int As Integer

    Private Sub MetroPanelSelection1_MouseDown(sender As Object, e As MouseEventArgs) Handles MetroPanelSelection1.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Form1StartPosition = Me.Location
            Form1DragPosition = Me.PointToScreen(New Point(e.X, e.Y))
        End If
    End Sub

    Private Sub MetroPanelSelection1_MouseMove(sender As Object, e As MouseEventArgs) Handles MetroPanelSelection1.MouseMove
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Dim CursorPosition As Point = Me.PointToScreen(New Point(e.X, e.Y))
            Me.Location = New Point(Form1StartPosition.X + CursorPosition.X - Form1DragPosition.X, _
              Form1StartPosition.Y + CursorPosition.Y - Form1DragPosition.Y)
        End If
    End Sub
    '++++++++++++++++++ | Funktionen die beim klicken der Checkboxen ausgeführt werden sollen | ++++++++++++++++++
    Private Sub MetroCheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox_P.CheckedChanged '1
        nur_2_von_4_checkbox()
    End Sub

    Private Sub MetroCheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox_U.CheckedChanged '2
        nur_2_von_4_checkbox()
    End Sub

    Private Sub MetroCheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox_R.CheckedChanged '3
        nur_2_von_4_checkbox()
    End Sub

    Private Sub MetroCheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox_I.CheckedChanged '4
        nur_2_von_4_checkbox()
    End Sub
    '------------------ | Funktionen die beim klicken der Checkboxen ausgeführt werden sollen | ------------------
    '++++++++++++++++++ | Den Trackbars die Zahlenwerte der Textboxen geben | ++++++++++++++++++
    Private Sub TextBox_P_TextChanged1(sender As Object, e As EventArgs) Handles TextBox_P.TextChanged '5
        Dim sText As String = TextBox_P.Text
        Dim sInt As Integer
        sText = sText.Replace("_", "") ' Entfernt die _
        sInt = CInt(Val(sText)) ' Verwandelt String in Integer
        TrackBar_P.Value = sInt
        Berechnung()
    End Sub

    Private Sub TextBox_U_TextChanged2(sender As Object, e As EventArgs) Handles TextBox_U.TextChanged '6
        Dim sText As String = TextBox_U.Text
        Dim sInt As Integer
        sText = sText.Replace("_", "")
        sInt = CInt(Val(sText))
        TrackBar_U.Value = sInt
        Berechnung()
    End Sub

    Private Sub TextBox_R_TextChanged3(sender As Object, e As EventArgs) Handles TextBox_R.TextChanged '7
        Dim sText As String = TextBox_R.Text
        Dim sInt As Integer
        sText = sText.Replace("_", "")
        sInt = CInt(Val(sText))
        TrackBar_R.Value = sInt
        Berechnung()
    End Sub

    Private Sub TextBox_I_TextChanged4(sender As Object, e As EventArgs) Handles TextBox_I.TextChanged '8
        Dim sText As String = TextBox_I.Text
        Dim sInt As Integer
        sText = sText.Replace("_", "")
        sInt = CInt(Val(sText))
        TrackBar_I.Value = sInt
        Berechnung()
    End Sub
    '------------------ | Den Trackbars die Zahlenwerte der Textboxen geben | ------------------
    Private Sub MetroTrackbar4_Scroll(sender As Object, e As MetroSuite.MetroProgressbarEventArgs) Handles TrackBar_P.Scroll '9
        TextBox_P.Text = TrackBar_P.Value
        ' InfoCode: ToolStripStatusLabel1.Text = "Wert für P wurde geändert"
    End Sub
    Private Sub MetroTrackbar3_Scroll(sender As Object, e As MetroSuite.MetroProgressbarEventArgs) Handles TrackBar_U.Scroll '10
        TextBox_U.Text = TrackBar_U.Value
        ' InfoCode:  ToolStripStatusLabel1.Text = "Wert für U wurde geändert"
    End Sub
    Private Sub MetroTrackbar2_Scroll(sender As Object, e As MetroSuite.MetroProgressbarEventArgs) Handles TrackBar_R.Scroll '11
        TextBox_R.Text = TrackBar_R.Value
        ' InfoCode: ToolStripStatusLabel1.Text = "Wert für R wurde geändert"
    End Sub
    Private Sub MetroTrackbar1_Scroll(sender As Object, e As MetroSuite.MetroProgressbarEventArgs) Handles TrackBar_I.Scroll '12
        TextBox_I.Text = TrackBar_I.Value
        ' InfoCode: ToolStripStatusLabel1.Text = "Wert für I wurde geändert"
    End Sub

    Private Sub NumericUpDown_P_ValueChanged(sender As Object, e As EventArgs) Handles NumUpDown_P.ValueChanged '13
        Berechnung()
        Case_NumUpDown_P()
    End Sub
    Private Sub NumericUpDown_U_ValueChanged(sender As Object, e As EventArgs) Handles NumUpDown_U.ValueChanged '14
        Berechnung()
        Case_NumUpDown_U()
    End Sub
    Private Sub NumericUpDown_R_ValueChanged(sender As Object, e As EventArgs) Handles NumUpDown_R.ValueChanged '15
        Berechnung()
        Case_NumUpDown_R()
    End Sub
    Private Sub NumericUpDown_I_ValueChanged(sender As Object, e As EventArgs) Handles NumUpDown_I.ValueChanged '16
        Berechnung()
        Case_NumUpDown_I()
    End Sub
    'checkbox control
    Private Sub cb_reset1() '22
        CheckBox_I.Enabled = False
        CheckBox_R.Enabled = False
        CheckBox_U.Enabled = False
        CheckBox_P.Enabled = False
    End Sub

    Private Sub bool_int_überprüfung() '23
        Select Case help_B
            Case False
                help_int = 0
            Case True
                help_int = 1
            Case Else

        End Select
    End Sub


End Class